package day240602;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

public class PropertiesDemo {
    public static void main(String[] args) throws IOException{
        Properties properties = new Properties();
        /*properties.put("username", "admin");
        properties.put("password", "secret");
        properties.put("token", "fjldsafjadlsflasdjflasdjfas");*/
        File file = new File("ice1/src/day240602/config.properties");
        //上传到文件里
        properties.load(new FileInputStream(file));
        System.out.println(properties);
        System.out.println(properties.getProperty("username"));
        // 对 properties 做了一些更新
        properties.setProperty("username", "admin");
        properties.store(new FileOutputStream(file), properties.toString());
    }
}
